import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

//loading加载框
class MultiLoading extends StatelessWidget {
//loading动画
  final Widget? loadingView;
  //提示内容
  final String? content;
  //是否显示提示文字
  final bool showContent;
  //圆角大小
  final double radius;
  //文字颜色
  final Color textColor;
  //背景颜色
  final Color backgroundColor;

  MultiLoading(
      {Key? key,
      this.loadingView,
      this.content,
      this.showContent = false,
      this.radius = 5,
      this.textColor = Colors.black,
      this.backgroundColor = Colors.white})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
        alignment: Alignment.topCenter,
        child: Container(
          color: backgroundColor,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.max,
            children: <Widget>[
              loadingView ?? SpinKitCircle(color: textColor, size: 50.0),
              SizedBox(height: 20.h),
              showContent
                  ? Text(content ?? '加载中...', style: TextStyle(fontSize: 15.0, color: textColor))
                  : const SizedBox.shrink(),
            ],
          ),
        ));
  }
}
